<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Title</title>
</head>
<!--<link rel="stylesheet" href="../layui/css/layui.css">-->
<body>
<form action="" class="layui-form" lay-filter="rn2Form" id="add_rn2_form" style="margin-left: 20px;margin-right: 20px">
<table  lay-filter="rnTable" id="rnTable"></table>
    <input type="hidden" name="start" id="text1a">
        <input type="hidden" name="end" id="text2a">
        <input type="hidden" name="pmId" id="managess">
    <div class="layui-inline">
        <label class="layui-form-label">审核意见</label>
        <div class="layui-input-inline" style="width: 200px;">
            <select id="did" name="did">
                <option value="-1">请选择</option>
            </select>
        </div>
    </div>
    <button type="button" class="layui-btn" style="margin-left: 20px;" onclick="skshSave()" lay-submit=""> 审核通过</button>
</form>
<script>
    var table ;
    var form;
    layui.use(['form','table'],function(){
        table = layui.table;
        form = layui.form;
         var timepp = setInterval(function () {
               if ($("#managess").val() != ""){
                   clearInterval(timepp);
                   $.get("http://localhost:9999/Te/fxName",{deStartyears: $("#text1a").val(),deEndyears: $("#text2a").val(), cmId:$("#managess").val()},function (data) {
                       var array = new Array();
                       array.push({field:'pid',title:'编号'});
                       array.push({field:'pName',title:'名称',templet:function (d) {
                               return d.child.pName;
                           }});
                       array.push({field:'cmNamea',title:'班级',templet:function (d) {
                               return d.child.manage.cmName;
                           }});
                       array.push({field:'sj',title:'收费区间',width:200,templet:function (d) {
                               return d.deStartyears+" --- "+d.deEndyears;
                           }});
                       for (let i = 0; i < data.length; i++) {
                           array.push({field:'pid',title:data[i],templet:function (d) {
                                   for (let j = 0; j < d.child.fxinfos.length; j++) {
                                       if (data[i] == d.child.fxinfos[j].ciName) {
                                           return d.child.fxinfos[j].price;
                                       }
                                   }
                                   return '0.00';
                               }});
                       }
                       array.push({field:'a',title:'总价格',templet:function (d) {
                               return d.totalSum;
                           }});
                       table.render({
                           elem: '#rnTable',
                           cols:[array],
                           id:'rnTable',
                           text:{none:'请根据日期年级班级生成费项'},
                           url:'http://localhost:9999/Te/index',
                           even:true,
                           where : {
                               deStartyears: $("#text1a").val(),
                               deEndyears: $("#text2a").val(),
                               cmId:$("#managess").val()
                           }
                       })
                   })
               }
           },100)
    });
    function skshSave() {
                var sj = $("#add_rn2_form").serialize();
                $.get("http://localhost:9999/Sksh/update",sj,function () {
                    alert("提交成功");
                    location.reload(true);
                })
    }

</script>
</body>
</html>